class PrdCataDict:
    from p_harmony.utils.string_util import StringUtil
    from p_harmony.utils.model_util import ModelUtil

    id = None
    createNo = None
    createName = None
    createTime = None
    updateTime = None
    prdCataCode = None
    prdCataName = None

    def __init__(self):
        pass

    def __str__(self):
        return f"<%s(%s)>" % (
            self.__class__.__name__,
            ", ".join([f"{k}={{v}}" for k, v in self.__dict__.items() if not k.startswith('_')])
        )

    def to_dict(self):
        """
        将模型对象转换为字典，以便进行JSON序列化
        显式拼接所有定义的字段，避免序列化隐藏属性
        """
        return {
            'id': self.id,
            'createNo': self.createNo,
            'createName': self.createName,
            'createTime': self.createTime,
            'updateTime': self.updateTime,
            'prdCataCode': self.prdCataCode,
            'prdCataName': self.prdCataName,
        }

    @classmethod
    def from_dict(cls, data):
        """
        从字典创建模型对象
        """
        instance = cls()
        for key, value in data.items():
            if hasattr(instance, key):
                setattr(instance, key, value)
        return instance
